part of Course 131 Data Munging Tips and Tricks


A trick that I've found useful is to make a toolbox of methods that I re-use often. That way, when I need to, say, read and parse a quirky file format I can just do this

from toolbox import texttools as ttl
ttl.parse_weird_file(filename)

where parse_weird_file() is a function that I meticulously copied, pasted, and tweaked from StackOverflow a long time ago. There are a few steps at the command line to set this up, but nothing too hairy.

Now any changes you make to texttools.py or any other files you add to toolbox/toolbox will be available for python3 to import, no matter which directory you're working in. It's guaranteed to cut your googling time in half.